package com.heima.wemedia.controller.v1;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.WmMaterialDto;
import com.heima.wemedia.service.WmMaterialService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;

@Api(tags = {"自媒体端-素材管理"})
@RestController
@RequestMapping(path = {"//api/v1/material"})
public class WeMaterialController {

    @Resource
    private WmMaterialService wmMaterialService;

    @ApiOperation(value = "上传图片素材")
    @PostMapping(path = {"/upload_picture"})
    public ResponseResult uploadPicture(@RequestParam(value = "multipartFile") MultipartFile multipartFile){
        return wmMaterialService.uploadPicture(multipartFile);
    }

    @ApiOperation(value = "素材列表查询")
    @PostMapping(path = {"/list"})
    public ResponseResult findList(@RequestBody WmMaterialDto wmMaterialDto){
        return wmMaterialService.findList(wmMaterialDto);
    }

}
